export function SET_KW(state, kw) {
  state.searchKw = kw;
}

export function CLEAR_KW(state) {
  state.searchKw = '';
}

export function SET_FILTER(state, v) {
  state.filters = state.filters || {};
  const obj = { ...state.filters, ...v };
  localStorage.setItem('filters', JSON.stringify(obj));
  state.filters = obj;
}

export function CLEAR_FILTER(state, k) {
  const obj = { ...state.filters };
  delete obj[k];
  localStorage.setItem('filters', JSON.stringify(obj));
}

export function CLEAR_FILTERS(state) {
  localStorage.setItem('filters', JSON.stringify({}));
  state.filters = {};
}

export function SET_NATION(state, n) {
  state.nation = n;
  localStorage.setItem('nation', n);
}
